﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

using System.Net;

namespace FacebookTestUserManager
{
    public partial class MainWindow : Window
    {
        

        public MainWindow()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
        }

        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            this.appId.Text = Config.Get("AppId");
            this.appSecret.Text = Config.Get("AppSecret");
        }

        private void Start_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var appId = this.appId.Text;
                var appSecret = this.appSecret.Text;

                var accessToken = FacebookHelper.GetAccessToken(appId, appSecret);

                var manager = new ManagerWindow();
                manager.AccessToken = accessToken;
                manager.AppId = appId;
                manager.ShowDialog();


            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }
    }
}
